import React, { Suspense } from 'react'
import CircularProgress from '@mui/material/CircularProgress'
import Box from '@mui/material/Box'

const lazyLoad = (Comp: React.LazyExoticComponent<any>): React.ReactNode => {
  return (
    <Suspense
      fallback={
        <Box className="box-center flex-col full-v">
          <CircularProgress />
          <span className="mt-2">loding...</span>
        </Box>
      }
    >
      <Comp />
    </Suspense>
  )
}

export default lazyLoad
